<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=750, user-scalable=0">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <title>需要搬运</title>
    <link rel="stylesheet" href="/Public/css/weui.css?t=201410289856">
    <link rel="stylesheet" href="/Public/css/jquery-weui.min.css?t=201410289856">
    <link href="/Public/css/style.css?t=201410289856" rel="stylesheet">
    <style>
       .auto-item {
    font-size: 30px;
    cursor: pointer;
    padding: 4px;
}
.car_desc {
    font-size: 30px;
}
   header{
    z-index: 9999;
   }
#mudi{
   position: relative; 
}


.amap-sug-result {
    position: absolute;
    z-index: 0;
    background-color: #fefefe;
    border: 0px;
}

.xl-item{
    height: 100%;
}

.header{
    width: 100%;
    top: 0;
    left: 0;
    height: 110px;
    background-color: #26adec;
    position: fixed;
    z-index: 100;
}
.header h1 {
    width: 100%;
    color: #fff;
    font-size: 48px;
    height: 110px;
    line-height: 110px;
    text-align: center;
    margin: 0;
    font-weight: normal;
}
.header .header-address {
    position: absolute;
    left: 30px;
    height: 110px;
    line-height: 110px;
    color: #ebecec;
    font-size: 36px;
    padding-right: 35px;
    background: url(../img/bottom.png) no-repeat right center;
}
header{
    position:fixed;
}

/* #add_form1{padding-top: 110px; }  */
    </style>

    
</head>

<body>
        <div class="layout fixed" id="page-home">
        <!-- <div class="header">
            <a href="#" class="header-address">青岛</a>
            <h1>挪窝儿</h1>
        </div> -->
        <header>
            <a href="#" class="header-address">青岛</a>
            <h1>挪窝儿</h1>
        </header>
         
         <form class="am-form" id="add_form1" name="form1" action="/index.php/Shows/third" method="post" ONSUBMIT="return check();">
        <div class="address-bd" id="chufa">
            <div class="address-input clearfix">
                <div class="fl ico ico-address"></div>
                <input type="text" class="fl tm-input startAdd" style="color: #000000" id="startAdd" name="startAdd" placeholder="输入出发地">
            </div>
            
            <div class="address-option">
                <span class="name">电梯</span>
                <input class="weui_switch weui_switch1" type="checkbox" name="shighdianti[]">
                <div class="ceng">
                    <input type="text" id="chufaceng" class="elevator1" value="1" name="shigh">
                    <span class="dw">层</span>
                </div>
            </div>
        </div>
        <div class="address-bd" id="mudi">
            <div class="address-input clearfix">
                <div class="fl ico ico-address"></div>
                <input type="text" class="fl tm-input endAdd"  id="endAdd" name="endAdd" style="color: #000000;
                -webkit-user-modify:read-write-plaintext-only;" placeholder="输入目的地">
            </div>
            <div class="address-option">
                <span class="name">电梯</span>
                <input class="weui_switch weui_switch2" type="checkbox" name="ehighdianti[]">
                <div class="ceng">
                    <input type="text" id="mudiceng" class="elevator2" value="1" name="ehigh">
                    <span class="dw">层</span>
                </div>
            </div>
        </div>
        <div class="ban-list">
            <div class="ban-item">
                <div class="fl ico ico-xl"></div>
                <input type="text" id="select-js" style="color: #000000" placeholder="选择行李件数" name="count-input" class="count-input">
                <a href="javascript:jsbz();" class="link-jsbz">计算标准</a>
            </div>
            <div class="ban-item" id="select-jj">
                <div class="fl ico ico-bx">
                </div>
                <input type="text"  style="color: #000000" name="jiaju" class="input-name option-jj" placeholder="如有大件家电家具请选择" readonly>
            </div>
            <div class="ban-item on" id="select-cart">
                <div class="fl ico ico-cart">
                </div>
                <span class="option-cart"><input type="text" name="car" id="car" class="input-name" style="width:400px;" placeholder="请选择合适您的车型" readonly></span>
                <a href="javascript:;;" class="gg" id="change_cart">更改</a>
            </div>
            <div class="ban-item">
                <div class="fl ico ico-time">
                </div>
                <input type="text" id="select-time" name="appDate" placeholder="请选择日期和时间" />
            </div>
            <div class="ban-item">
                <div class="fl ico ico-tel">
                </div>
                <input name="mphone" type="tel" class="input-tel" placeholder="请填写您的手机号 " maxlength="11">
            </div>
            <div class="ban-item">
                <div class="fl ico ico-name">
                </div>
                <input type="text" name="name" class="input-name" placeholder="怎么称呼 （姓名）">
            </div>
        </div>
        <div class="beizhu">
            <textarea name="beizhu" id="beizhu" cols="30" placeholder="用户备注"></textarea>
        </div>
        <div class="confirm-order" id="submit_order">
            <div class="order-info">
                <div class="price fl">
                    <span class="fh">￥</span>
                    <span class="jg" id="cost">0</span><font class="dw_qi" color="red" >元</font>
                    <span class="gl" id="dst" style="margin-left: 10px">0</span>公里
                </div>
                <div class="fr">
                    <div class="fr-item">
                        <span>车&nbsp;&nbsp;&nbsp;&nbsp;费：</span><font id="fc">0</font>元
                    </div>
                    <div class="fr-item">
                        <span>搬运费：</span><font id="fb">0</font><font class="dw_qi">元</font>
                    </div>
                </div>
            </div>
            
            <input type="hidden" name="getCity" value="青岛"  />
            <input type="hidden" name="is_start" id="is_start" value=""  />
            <input type="hidden" name="is_end" id="is_end" value=""  />
            <input type="hidden" name="cost" id="costInput" value="0"  />
            <input type="hidden" name="costFb" id="costFb" value="0"/>
		    <input type="hidden" name="ben" id="ben" value=""/>
            <input type="hidden" name="distance" id="distance" value=""/>
            <input type="hidden" name="bei1" id="h_bei1" value=""/>
            <input type="hidden" name="bei2" id="h_bei2" value=""/>
            <button class="btn-confirm" id="addorder">确认订单</button>
        </div>
        <div id="jsbz" class="hide">
        	<div class="box">
        		<a href="javascript:close();" class="close"></a>
        		<img src="/Public/img/raw_1468482878.png" width="668px" height="500px" alt="" style="max-width: 90%">
        	</div>
        </div>
        </form>
    </div>
    
    <div class="layout fixed2" id="page-select-dxl" style="display: none;">
        <header>
            <a href="javascript:back();" class="link-left">返回</a>
        </header>
        <div class="xl-list">
        	<div class="xl-item">
                <div class="pic">
                    <img src="/Public/images/1/05.png" alt="">
                </div>
                <div class="bd">
                    普通洗衣机
                </div>
                <div class="select-num">
                    <div class="jian hide"><i class="iconfont">&#xe760;</i></div>
                    <input type="text" value="0" class="num hide xiyiji1" name="xiyiji[]" readonly>
                    <div class="add"><i class="iconfont">&#xe610;</i></div>
                </div>
            </div>
            
            <div class="xl-item">
                <div class="pic">
                    <img src="/Public/images/1/06.png" alt="">
                </div>
                <div class="bd">
                    波轮洗衣机
                </div>
                <div class="select-num">
                    <div class="jian hide"><i class="iconfont">&#xe760;</i></div>
                    <input type="text" value="0" class="num hide xiyiji2"  name="xiyiji[]" readonly>
                    <div class="add"><i class="iconfont">&#xe610;</i></div>
                </div>
            </div>
            
            <div class="xl-item">
                <div class="pic">
                    <img src="/Public/images/1/07.png" alt="">
                </div>
                <div class="bd">
                    滚筒洗衣机
                </div>
                <div class="select-num">
                    <div class="jian hide"><i class="iconfont">&#xe760;</i></div>
                    <input type="text" value="0" class="num hide xiyiji3" name="xiyiji[]"  readonly="readonly">
                    <div class="add"><i class="iconfont">&#xe610;</i></div>
                </div>
            </div>
            
        </div>
        <div class="xl-list">
        	<div class="xl-item">
                <div class="pic">
                    <img src="/Public/images/1/08.png" alt="">
                </div>
                <div class="bd">
                    单门小冰箱 1m以下
                </div>
                <div class="select-num">
                    <div class="jian hide"><i class="iconfont">&#xe760;</i></div>
                    <input type="text" value="0" class="num hide bingxiang1"  name="bingxiang[]" readonly>
                    <div class="add"><i class="iconfont">&#xe610;</i></div>
                </div>
            </div>
            
            <div class="xl-item">
                <div class="pic">
                    <img src="/Public/images/1/09.png" alt="">
                </div>
                <div class="bd">
                    双门冰箱高 1m-1.7m
                </div>
                <div class="select-num">
                    <div class="jian hide"><i class="iconfont">&#xe760;</i></div>
                    <input type="text" value="0" class="num hide bingxiang2" name="bingxiang[]" readonly>
                    <div class="add"><i class="iconfont">&#xe610;</i></div>
                </div>
            </div>
            
            <div class="xl-item">
                <div class="pic">
                    <img src="/Public/images/1/10.png" alt="">
                </div>
                <div class="bd">
                    双门或三门冰箱高 1.7m以上
                </div>
                <div class="select-num">
                    <div class="jian hide"><i class="iconfont">&#xe760;</i></div>
                    <input type="text" value="0" class="num hide bingxiang3" name="bingxiang[]" readonly>
                    <div class="add"><i class="iconfont">&#xe610;</i></div>
                </div>
            </div>
            
        </div>
        
        <div class="xl-list">
        	<div class="xl-item">
                <div class="pic">
                    <img src="/Public/images/1/11.png" alt="">
                </div>
                <div class="bd">
                    单人床
                </div>
                <div class="select-num">
                    <div class="jian hide"><i class="iconfont">&#xe760;</i></div>
                    <input type="text" value="0" class="num hide chuang1" name="chuang[]"  readonly="readonly">
                    <div class="add"><i class="iconfont">&#xe610;</i></div>
                </div>
            </div>
            
            <div class="xl-item">
                <div class="pic">
                    <img src="/Public/images/1/12.png" alt="">
                </div>
                <div class="bd">
                    双人床
                </div>
                <div class="select-num">
                    <div class="jian hide"><i class="iconfont">&#xe760;</i></div>
                    <input type="text" value="0" class="num hide chuang2"  name="chuang[]" readonly>
                    <div class="add"><i class="iconfont">&#xe610;</i></div>
                </div>
            </div>
            
            <div class="xl-item">
                <div class="pic">
                    <img src="/Public/images/1/13.png" alt="">
                </div>
                <div class="bd">
                    单人床垫
                </div>
                <div class="select-num">
                    <div class="jian hide"><i class="iconfont">&#xe760;</i></div>
                    <input type="text" value="0" class="num hide chuang3" name="chuang[]"  readonly="readonly">
                    <div class="add"><i class="iconfont">&#xe610;</i></div>
                </div>
            </div>
            
            <div class="xl-item">
                <div class="pic">
                    <img src="/Public/images/1/14.png" alt="">
                </div>
                <div class="bd">
                    双人床垫
                </div>
                <div class="select-num">
                    <div class="jian hide"><i class="iconfont">&#xe760;</i></div>
                    <input type="text" value="0" class="num hide chuang4"  name="chuang[]" readonly>
                    <div class="add"><i class="iconfont">&#xe610;</i></div>
                </div>
            </div>
            
        </div>
        <p class="tips">其他未列出家具请选择件数并用文字描述</p>
        <div class="dxl-list">
            <div class="dxl-item">
                <div class="hd">
                    <div class="pic">
                        <img src="/Public/images/1/15.png" alt="">
                    </div>
                    <div class="title">
                        一人可搬动的家具
                    </div>
                    <div class="select-num">
                        <div class="jian hide"><i class="iconfont">&#xe760;</i></div>
                        <input type="text" value="0" class="num hide people1"  name="people[]" readonly>
                        <div class="add"><i class="iconfont">&#xe610;</i></div>
                    </div>
                </div>
                <div class="bd hide">
                	<textarea name="bei1" id="bei1" cols="30" rows="10" placeholder="一个人可以搬动的家具，比如椅子，单人沙发，床头柜，镜子等，选择件数后请在此添加文字描述"></textarea>
                </div>
            </div>
            <div class="dxl-item">
                <div class="hd">
                    <div class="pic">
                        <img src="/Public/images/1/16.png" alt="">
                    </div>
                    <div class="title">
                        需要两人一起搬动的家具
                    </div>
                    <div class="select-num">
                        <div class="jian hide"><i class="iconfont">&#xe760;</i></div>
                        <input type="text" value="0" class="num hide people2"  name="people[]" readonly>
                        <div class="add"><i class="iconfont">&#xe610;</i></div>
                    </div>
                </div>
                <div class="bd hide">
                	<textarea name="bei2" id="bei2" cols="30" placeholder="需要两个人抬的家具，如茶几，餐桌，小型两门衣柜等，选择件数后请在此添加详细文字描述" rows="10"></textarea>
                </div>
            </div>
        </div>
        <div class="confirm-order">
            <button  class="btn-confirm jiaju-confirm">确认提交</button>
        </div>
    </div>
    
    <div class="layout fixed2" id="page-select-car" style="display: none;">
        <header>
            <a href="javascript:back();" class="link-left">返回</a>
        </header>
        <div class="xl-list">
        	<div class="xl-item car1">
                <div class="pic">
                    <img src="/Public/images/1/01.png" alt="">
                </div>
                <div class="bd">
                   
                    <div class="car_desc">
                      <h3>面包车</h3>
                    空间尺寸：长2m/宽1.3m/高1.3m <br/>
可容纳15个左右行李箱/编织袋/纸箱<br/>
可容纳洗衣机（体积相当于3件左右行李）<br/>
起步5公里35元，超里程每公里4元<br/>

                    </div>
                </div>
            </div>
            <div class="xl-item car2">
                <div class="pic">
                    <img src="/Public/images/1/02.png" alt="">
                </div>
                <div class="bd">
                  
                    <div class="car_desc">
                      <h3>小型平板货车</h3>
                    空间尺寸：长3m/宽1.7m/高1.8m<br/>
可容纳洗衣机/冰箱/床/床垫等所有常见行李<br/>
开放空间，不适用雨雪天气<br/>
起步5公里50元，超里程每公里5元<br/>
                    </div>
                </div>
            </div>
            <div class="xl-item car3">
                <div class="pic">
                    <img src="/Public/images/1/03.png" alt="">
                </div>
                <div class="bd">
                    <div class="car_desc">
                    <h3>中型平板货车</h3>
                    空间尺寸：长4m/宽1.8m/高1.8m<br/>
可容纳洗衣机/冰箱/床/床垫等所有常见行李<br/>
开放空间，不适用雨雪天气<br/>
起步5公里80元，超里程每公里5元<br/>
                    </div>
                </div>
            </div>
            <div class="xl-item car4">
                <div class="pic">
                    <img src="/Public/images/1/04.png" alt="">
                </div>
                <div class="bd">
                    <div class="car_desc">
                    <h3>中型厢式货车</h3>
                    空间尺寸：长4m/宽1.8m/高1.8m<br/>
可容纳洗衣机/冰箱/床/床垫等所有常见行李<br/>
封闭空间，不受天气影响<br/>
起步5公里100元，超里程每公里5元<br/>
                    </div>
                </div>
            </div>
            
        </div>
    </div>
    
    <div id="l-map"></div>
    <script src="/Public/js/jquery.min.js?t=201410289856"></script>
    <script src="/Public/js/jquery-weui.min.js?t=201410289856"></script>
    <script src="/Public/js/webapp.js?t=201410289856"></script>
       <!-- 高德地图 -->
 <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=aab886d4a59efc2916aee2f60db1c886"></script>
    
    <!-- 百度地图 -->
	<!-- <script type="text/javascript"
        src="http://api.map.baidu.com/api?v=2.0&ak=cRIblrzawnZeT319eL3dLssL"></script>
    <script src="/Public/js/map.js?t=201410289856"></script> -->
     <script src="/Public/js/elavator.js?t=201410289856"></script>
    <script>
        (function (doc, win) {
  var docEl = doc.documentElement,
    resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
    recalc = function () {
      var clientWidth = docEl.clientWidth;
      if (!clientWidth) return;
      docEl.style.fontSize = 100 * (clientWidth / 320) + 'px';
    };

  // Abort if browser does not support addEventListener
  if (!doc.addEventListener) return;
  win.addEventListener(resizeEvt, recalc, false);
  doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);
        
    
        $(document).ready(function(){
  $('#startAdd').focus();
      var bind_name = 'input';
      if (navigator.userAgent.indexOf("MSIE") != -1){
        bind_name = 'propertychange';
      }
      $('#startAdd').bind(bind_name, function(){
        　var reg = new RegExp("[\\u4E00-\\u9FFF]+","g");

        if(reg.test($(this).val())){     
      $('#startAdd').val($(this).val());       
　　}  

        
      })



});


    var value1='';
    var value2='';
    AMap.plugin('AMap.Autocomplete',function(){
    //实例化Autocomplete
    var autoOptions = {
        city: "青岛市", 
        input:"startAdd"
    };
    autocomplete= new AMap.Autocomplete(autoOptions);


     AMap.event.addListener(autocomplete, "select", function(e){

        value1=[e.poi.location.lng,e.poi.location.lat];
        if (value2!='') {
            //alert(value2);
        go_search(value1,value2);
    }
             
     });

     var autoOptions2 = {
        city: "青岛市", 
        input:"endAdd"
    };
    autocomplete2= new AMap.Autocomplete(autoOptions2);

    AMap.event.addListener(autocomplete2, "select", function(e){

        value2=[e.poi.location.lng,e.poi.location.lat];
          console.log(value2);  
          go_search(value1,value2)


     });


    //TODO: 使用autocomplete对象调用相关功能
})

 function go_search(v1,v2){

                AMap.service('AMap.Driving',function(){
    //实例化Driving
    driving= new AMap.Driving({city: '青岛市'});
    //TODO: 使用driving对象调用驾车路径规划相关的功能
     //根据起终点坐标规划驾车路线
   

    driving.search(v1, v2, function(status, result) {
        if(status === 'complete' && result.info === 'OK'){
            console.log(result.routes['0'].distance);
              var opt=result.routes['0'].distance;
              opt=opt/1000;
                $("#dst").html(opt);
                $("#distance").val(opt);
                chuanAjax();
        }else{
             alert('地址错误');
        }
        
 });

})

}

$("#startAdd").bind("blur",function(){
        var startAdd = $("#startAdd").val();
        if (startAdd!= "") {
            geocoder(startAdd);
        }
      
    });

$("#endAdd").bind("blur",function(){
        var startAdd = $("#startAdd").val();
        var endAdd = $("#endAdd").val();
        //如果起始地点和目的地都填了值，那么就去调用
        if (endAdd!= ""&&startAdd != "") {
            geocoder(startAdd);
            geocoder(endAdd);
        }
      
    });


  function geocoder(a) {
        AMap.plugin("AMap.Geocoder",function(){  
geocoder=new AMap.Geocoder({ 
city:"0532",
radius:1000 
}); 
//地理编码,返回地理编码结果
        geocoder.getLocation(a, function(status, result) {
            if (status === 'complete' && result.info === 'OK') {
                //geocoder_CallBack(result);
            }else{
                if (value1=='') {
                alert('地址错误');
                return false;
            }
                
            }
        });


});
        
}

 function geocoder_end(a,b) {
        AMap.plugin("AMap.Geocoder",function(){  
geocoder=new AMap.Geocoder({ 
city:"0532",
radius:1000 
}); 
//地理编码,返回地理编码结果
        geocoder.getLocation(a, function(status, result) {
            if (status === 'complete' && result.info === 'OK') {
                //geocoder_CallBack(result);
            }else{
                alert('出发地无法解析');
                return false;
            }
        });

        geocoder.getLocation(b, function(status, result) {
            if (status === 'complete' && result.info === 'OK') {
                //geocoder_CallBack(result);
            }else{
                alert('目的地无法解析');
                return false;
            }
        });


});
        
}

		//传ajax
		function chuanAjax() {
			$.post("/index.php/Shows/banYun", {
				sAdress : $("#startAdd").val(),
				eAdress : $("#endAdd").val(),
				car : $("#car").val(),
				dst : $('#dst').html(),
				fb:$("#costFb").val(),
				
			}, function(data, status) {
				//alert(data);
				datastr = data.split("|");

				$("#cost").html(datastr[0]);
				$("#costInput").val(datastr[0]);
				$("#fc").html(datastr[1]);
				$("#fb").html(datastr[0]-datastr[1]);
				
			});
		}
		  function check(){
            var r1=document.form1.startAdd.value;
            var r2=document.form1.endAdd.value;
            var dst=$('#dst').html();
            if (dst==0) {
                alert('地址输入错误,请选择下拉推荐地址');
                return false;
            }

         

            if(r1.replace(/(^\s*)|(\s*$)/g, "").length==0){
                  alert("请输入出发地!");
                  document.form1.startAdd.value="";
                  document.form1.startAdd.focus();
                  return false;
            }else{
                 AMap.plugin("AMap.Geocoder",function(){  
geocoder=new AMap.Geocoder({ 
city:"0532",
radius:1000 
}); 
//地理编码,返回地理编码结果
        geocoder.getLocation(r1, function(status, result) {
            if (status === 'complete' && result.info === 'OK') {
                //geocoder_CallBack(result);
            }else{
                 if (value1=='') {
                  alert('出发地无法解析');
                return false;
                }
            }
        });


});
              
            }
            
            if(r2.replace(/(^\s*)|(\s*$)/g, "").length==0){
                  alert("请输入目的地!");
                  document.form1.endAdd.value="";
                  document.form1.endAdd.focus();
                  return false;
            }else{
                AMap.plugin("AMap.Geocoder",function(){  
geocoder=new AMap.Geocoder({ 
city:"0532",
radius:1000 
}); 
//地理编码,返回地理编码结果
        geocoder.getLocation(r2, function(status, result) {
            if (status === 'complete' && result.info === 'OK') {
                //geocoder_CallBack(result);
            }else{
                 if (value2=='') {
                  alert('目的地无法解析');
                   sessionStorage.setItem("demokey", "1");
                return false;
                }
               
            }
        });


});

            }
            
            if($(".count-input").val()=="" && $(".option-jj").val()==""){
                alert("行李件数和大件家电家具必须一个!");
                $(".count-input").focus();
                return false;
            }
            
            if($("#car").val()==""){
                alert("请选择合适您的车型!");
                $("#car").focus();
                return false;
            }
            
            if($("#select-time").val()==""){
                alert("请选择日期和时间!");
                $("#select-time").focus();
                return false;
            }else{
                var cur_time=new Date().getTime();
                var datetime=$("#select-time").val();
                var value = datetime.replace(/[^0-9]/ig,""); 
                
                var year=value.substr(0,4);
                var month=value.substring(4,6);

                if (value.length==15) {
                  var day='0'+value.substring(6,7);  
                }else{
                  var day=value.substring(6,8);   
                }
                var hour=value.substr(value.length-4).substring(0,2);
                var datetime= year+'-'+month+'-'+day+' '+hour+':00:00';
                var timestamp = Date.parse(new Date(datetime));
                if (cur_time>timestamp) {
                    alert('选择的时间不得早于当前时间');
                    return false;
                }
                
            }
            
            var reg = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
            if (!reg.test(document.form1.mphone.value)) {
              document.form1.mphone.value="";
              document.form1.mphone.focus();
              alert("请填写您的手机！");
              return false;
            };
            
        }


        $(".input-tel").focus(function(){
              $("#submit_order").css("position","absolute");
           
});
  $(".input-tel").blur(function(){
              $("#submit_order").css("position","fixed");
           
});
    



  
	</script>
</body>


</html>